<?php
//print_r($_GET);
?>
<style type="text/css">
	.red-star { color:#FF0000; }	
</style>
<?php
$disabled_seller 	= '';
$disabled_merchant 	= '';
$disabled_wholesaler 	= '';
if($_SESSION['user_type_sess']==2)
{
	$disabled_merchant 	= 'disabled="disabled"';
	$disabled_wholesaler 	= 'disabled="disabled"';
}
else if($_SESSION['user_type_sess']==3)
{
	$disabled_seller 	= '';
	$disabled_wholesaler 	= 'disabled="disabled"';
}
?>
<?php 
	// 10:35 PM, May 29, 2011
	$is_pass_amazone_land = false;
	if( isset($_SESSION['user_id_sess']) ){
		$query = "SELECT user_type, set_api, comm_tokenID FROM tbl_users WHERE user_id =".$_SESSION['user_id_sess'];
		$sqlQuery = mysql_query($query);
		$fetchDataArr = mysql_fetch_array($sqlQuery);
		if( strtolower($fetchDataArr['set_api']) == 'yes' && $fetchDataArr['comm_tokenID'] != ''){
			$is_pass_amazone_land = true;
		}
		$whoami = '';
		switch ($fetchDataArr['user_type']) {
			case 1:
				$whoami = 'buyer';break;
			case 2:
				$whoami = 'seller';break;
			case 3:
				$whoami = 'merchant';break;
			case 4:
				$whoami = 'seller/buyer';break;
			case 5:
				$whoami = 'wholesaler';break;
			default:
				$whoami ='';
			break;
		}
	}
?>

<?php
if($whoami == 'buyer'){
  //	echo '<script>window.location.href="'.$base_url.'index.php?sell&by=seller"</script>';
  }		
if($is_pass_amazone_land && $whoami == 'seller' ){
  echo '<script>window.location.href="'.$base_url.'index.php?sell&by=seller"</script>';
}
  
if(isset($_POST['smtSignin']) && $_POST['smtSignin']=="Start Selling")
{
  
  if($_POST['who']=="seller" && $_POST['my_option']=='sell_my_product')
  {
     echo '<script>window.location.href="'.$base_url.'index.php?sell&by=own"</script>';
  }
  else if($_POST['who']=="seller" && $_POST['my_option']=='sold_for_me')
  {
     echo '<script>window.location.href="'.$base_url.'index.php?srch&sg=all&key=&st=&cty=&pf=Min&pt=Max"</script>';
  }
  else if($_POST['who']=="seller" && $_POST['my_option']=='other_product')
  {
     echo '<script>window.location.href="'.$base_url.'index.php?addProduct"</script>';
  }
  else if($_POST['who']=="merchant" && $_POST['my_option']=='sell_my_product')
  {
     echo '<script>window.location.href="'.$base_url.'index.php?srch&sg=all&key=&st=&cty=&pf=Min&pt=Max"</script>';
  }
  if($_POST['who']=="wholesaler" && $_POST['my_option']=='sell_my_product')
  {
     echo '<script>window.location.href="'.$base_url.'index.php?index.php?import=1"</script>';
  }
  
  if($_POST['who'] == 'buyer'){
  	
  }
}
?>


<div id='panel'>
<a name="sellp" id="sellp"></a>
<div class="fulldiv" style="width:950px;">

<form action="" method="post" name="sell_form">
<table width="100%" border="0" class="signin_bg">
  <tr>
  	
	<td>
	
	<div class="signin_out">
	
	<div class="signin_top">&nbsp;</div>
	<div class="signin_repeat">
	
		<div style="text-align:center; width:100%; float:left;">
			<div class="selltxt">&nbsp;</div>
		</div>
		<div style="float: left; width: 100%; margin: 10px 0px; text-align: center; font-size: 14px;">
			I am a: 
			<input type="radio" name="who"  value="seller" onchange="enable_disable_s3()" checked <?php echo $disabled_seller; ?> />Seller&nbsp;&nbsp; 
			<input type="radio" name="who" value="merchant" onchange="enable_disable_s3()" <?php echo $disabled_merchant; ?> />Merchant&nbsp;&nbsp;
			<input type="radio" name="who" value="wholesaler" onchange="enable_disable_s3()" <?php echo $disabled_wholesaler; ?> />Wholesaler
		</div>
		<div style="float: left; width: 100%; margin: 10px 0px; text-align: center; font-size: 14px;">
			<div style="float: left; text-align: right; width: 130px;">My Options:</div>
			<div style="float: left; text-align: left; margin-left: 10px; width: 240px;">
				<input type="radio" name="my_option" id="s1" value="sell_my_product" checked /> Sell my product<br />
				<input type="radio" name="my_option" id="s2" value="sold_for_me" /> Have my products sold for me<br />
				<input type="radio" name="my_option" id="s3" value="other_product" /> Sell other user's products
			</div>
		</div>
		<div align="center" style="float: left; width: 100%; margin: 10px 0px; text-align: center; font-size: 14px;">
			<input style="float:none;" align="center" type="submit" value="Start Selling" name="smtSignin" id="smtSignin" class="yellow_btn" />
		</div>
	  
	</div>
	<div class="signin_bot">&nbsp;</div>
	
	</div>
	
	<div class="signrgt_out">
		
		<div class="signrgt_top">&nbsp;</div>
		<div class="signrgt_repeat">
			<table border="0" width="100%" align="center">
			
			<tr>
			<td class="blue_big">
			<span style="margin:15px 0px 10px 0px; float:left; width:100%;">Don't have an account yet?</span>
			</td>
			</tr>
			
			<tr>
			<td class="black_big"> <span style="margin:15px 0px 25px 0px; float:left;  width:100%;">Start making things happen</span></td>
			</tr>
			
			<tr>
			<td> 
			<span style="margin:15px 0px 15px 0px; float:left;  width:100%;">
			<!--<input type="button" value="Register" name="" id="" class="sbmt_btn" onclick="window.location='index.php?registerMember=seller'" />-->
<input type="button" value="Register" name="" id="" class="sbmt_btn" onclick="select_registration();" /></span>
			</td>
			</tr>
			
			<tr>
			<td>
				<div class="fulldiv">
					<div class="quoteimg">&nbsp;</div>
				</div>
				<div class="fulldiv">
					<div class="quote">This website offers more options to make money than any other website I've seen. I almost don't want to tell anyone about it.<br /><br />
					<br /><div style="float: right; text-align: right; margin: 10px 0px 0px;">Justin 34, California</div>
					</div>
				</div>
			</td>
			</tr>
			
			

			
			</table>
		</div>
		<div class="signrgt_bot">&nbsp;</div>
		
	</div>
	
	</td>
  </tr>
</table></form>	

</div>

</div>

<script type="text/javascript">
function  enable_disable_s3()
{
	if($("#merchant").is(":checked")==true)
	{
		$('#s3').attr('disabled','disabled');
		$('#s2').attr('disabled','');
		$('#s2').attr('checked','checked');
		$('#s1').attr('disabled','disabled');
	}
	else if($("#wholesaler").is(":checked")==true)
	{
		$('#s2').attr('disabled','disabled');
		$('#s1').attr('disabled','');
		$('#s1').attr('checked','checked');
		$('#s3').attr('disabled','disabled');
	}
	else {
		$('#s3').attr('disabled','');
		$('#s2').attr('disabled','');
		$('#s1').attr('disabled','');
	}
	
	
}

function select_registration()
{
  var l			=	document.sell_form.who.length;
  var tempVal	=	"";
  for (var i=0;i<l;i++)
  {
  	if (document.sell_form.who[i].checked)
	tempVal		=	document.sell_form.who[i].value;
  }
  tempVal		=	tempVal=='seller' ? 'registerMember=seller' : (tempVal=='merchant' ? 'registerMerchantRefCode' : 'registerWholesellerRefCode');
  window.location.href	=	'<?php echo $base_url;?>index.php?'+  tempVal;
}
</script>